﻿#ifndef WAITSAVE_H
#define WAITSAVE_H

#include <QImage>
#include "libaxidma.h"
#include "axil_cmd.h"
#include "sensor_user.h"
#include "camera_define.h"
#include "savethread.h"
#include "compresssendthread.h"



class WaitSave: public QObject
{
    Q_OBJECT
public:
    WaitSave();
    ~WaitSave();

    QByteArray IntToArray(int v);
    QByteArray ShortToArray(unsigned short v);
    void setData(bool* success_flag, axidma_dev_t dev, const array_t *chans, char *buf, axil_cmd_handle* cmd_user, unsigned char *mid0, int* name,
                 unsigned int* Index, CameraSpace::CameraInfo Info);
    void setPoint(QList<QByteArray>* listTra);
    void updataData(unsigned short picStartX,unsigned short picStartY,unsigned short picWidth,unsigned short picHeight,unsigned char exposureMode,unsigned char saveLocation);
    void SendPhotoMessage(QByteArray current_photo_message);
    void SetDeviceNum(const unsigned char k_device_num);
public slots:
    void saveAndTrans();
signals:
    void pictureOver();
private:
    void deletePhoto();
private:
    QImage image;
    SaveThread *pworkThread;//存储照片的线程
    CompressSendThread* saveThread;//传送照片的线程
//    QString path1 = "/run/media/nvme0n1/";
//    QString path2 = "/mnt/";
    QString delete_path_ = "/mnt/mnt1";
    QString path1 = "/mnt/mnt1/";
    QString path2 = "/mnt/mnt2/";
    QString load1;
    QString load2;
    QByteArray assist_message;
    bool* dma_success_flag;
    axidma_dev_t axidma_dev;
    const array_t *rx_chans;
    char *rx_buf;
    axil_cmd_handle* axil_cmd_user;
    unsigned char *image_mid0;
    int* fd_name;
    unsigned int* cameraIndex;
    CameraSpace::CameraInfo cameraInfo;
    QList<QByteArray>* list;
    QByteArray receive_photo_message_;
    unsigned char device_num_ = 0x01;
    unsigned short surplus_storage_ = 3000;
    static unsigned int num_trigger_;//交付时注掉

};

#endif // WAITSAVE_H
